﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%option explicit%>
<%
Dim RZ_IN
RZ_IN=1
%>
<!--#include file="../conn.inc.asp" -->
<!--#include file="admin_inc/admin.function.asp" -->
<!--#include file="admin_inc/admin.sqlfunction.asp" -->
<%
checkadmin(1)
Dim rs,sql,keyword,list,titlefield,result
list=HtmlEncode(request.querystring("list"))
keyword=HtmlEncode(unescape(request.querystring("keyword")))
If list="words" Then 
	If Len(keyword)>1 And keyword<>"l" And keyword<>"la" And keyword<>"lan" And keyword<>"lang" And keyword<>"lang_" Then
	Set rs=server.CreateObject("adodb.recordset")
	sql="select * from c_words where w_name like '%"&keyword&"%' or w_value like '%"&keyword&"%'"
	rs.open sql,conn,1,1
	result=result&"<div style='padding:5px;'><a href='?keyword="&escape(keyword)&"'>带关键字"&keyword&"的所有记录</span></a></div>"
	Do While Not rs.eof
	result=result&"<div style='padding:5px;'><a href='?keyword="&escape(rs("w_name"))&"'>"&rs("w_name")&"</span>&nbsp;&nbsp;"&rs("w_value")&"</a></div>"
	rs.movenext
	Loop 
	rs.close
	Set rs=Nothing 
	End If 
End If 

If Len(keyword)>1 Then 
	Set rs=server.CreateObject("adodb.recordset")
	If list="article" Then 
	sql="select * from c_article where title like '%"&keyword&"%'"
	titlefield="title"
	ElseIf list="product" Then
	sql="select * from c_product where productname like '%"&keyword&"%'"
	titlefield="productname"
	Else
	sql="select * from c_photo where photoname like '%"&keyword&"%'"
	titlefield="photoname"
	End If 
	rs.open sql,conn,1,1
	result=result&"<div style='padding:5px;'><a href='?keyword="&escape(keyword)&"'>带关键字"&keyword&"的所有记录</a></div>"
	Do While Not rs.eof
	result=result&"<div style='padding:5px;'><a href='?keyword="&escape(rs(titlefield))&"'>"&rs(titlefield)&"</a></div>"
	rs.movenext
	Loop 
	rs.close
	Set rs=Nothing 
End If 

response.write(result)
%>
